I want to filter an XML document.
Lets use a simple example:
Based on the code below, IF appears MORE than once in the document, WITHIN the tags, then it must point each occurrence out.
<car>
<engine>
</engine>
//THIS SHOULD THEN BE POINTED OUT//
<engine>
</engine>
//THIS SHOULD THEN BE POINTED OUT//
</car>
So it must show these with the click of a button(only if the conditions are true).
Maybe some sort of a program or xml schema?
Please any help would be much appreciated. Thanks in advance.
I have tried XML schema and Altova as well as excell.
Related
I have a question about using a certian drools functionality in drools decision spreadsheet, that would help a lot in reducing the files and making them more readable.
I can't add more than two links so please downlad this .zip file that includes:
Version1.PNG, Version1.drl, Version2.PNG, Version2.drl, Version3desired.drl
http://s000.tinyupload.com/?file_id=89653236807266194978
So here is the sample rule that we are using right now (something similar)Version1.PNG
And this when converted to a drl gives us the following 193 line long drl file. (Version1.drl)
It is ok and it works well, but after some research we found out we could use the "extends" functionality in drl.
And it works in a drl, what I would like to know is how would I use it in an Excel spreadsheet?
I designed the rule in this way: Version2.PNG
Clearly this is not how "extends" should be used in Excel, since this returns the following drl (Version2.drl)
You can see the extends is inside the "" of the rule name. Makes sense I guess, what I woudl like to know however is, how would I use it correctly? a seperate column? That didn't work, at least not the way I did it.
Does anyone know how It should be done?
The correct DRL that should be made after the Excel is converted is this: (Version3desired.drl)
Thank you for any help :)
Cheers!
There is no gain in using extends with spreadsheets in the way you describe it in your question.
I suggest that you stick to the spreadsheet layout shown in Version1.png. If data entry personnel complains about the dull repetition of 1/7/30 in oodles of rows, teach them how to join cells so they need to type each value only once.
I am trying to do document classification with gate. For that I need to annotate the entire document with one type of annotation. Can anyone please tell me how to do that?
Usually I use XML for that purpose. Something like:
<document class="class-1">
The text of you document 1 is here..
</document>
<document class="class-2">
The text of you document 2 is here..
</document>
Then save these xml as separated files (or as one document).
In GATE application you can use Annotation Set Transfer PR and move annotation from "Original markups" to default annotation set. This is one of the options. Other options depends on data format you have.
If your source documents are HTML or XML then there will already be an annotation in the Original markups set that spans all the content, otherwise the simplest option would be to load the Groovy plugin and use the scripting PR with a one-line script like
outputAS.add(doc.start(), doc.end(), "Document", Utils.featureMap())
Is there a quick way to find out all the mandatory field in a xsd file?
I need to quickly see all the mandatory fields in the schema
thanks
Not sure if you're looking to do this through code. If not, Altova XMLSpy, for example, provides an option to "Generate Sample XML File" - with options to generate only mandatory fields.
Otherwise, if you're working with Java, for example, you can use something like the Eclipse XSD project for programmatic access to the XSD. (It even works without Eclipse.) Some additional details at Are there any other frameworks that parse XSD other than XSOM? .
Take a look at this post; instead of exporting all fields, there's also an option to get only the mandatory ones... One significant difference compared with the answer you accepted is in that you can also generate an Excel or CSV file, in addition to the XML file; not to mention that the sample XML approach is deficient by definition... I would pay attention to the way mandatory choices, abstract typed elements or abstract elements with substitution groups play in your case.
i am using SPWeb.ProcessBatchData() method to batch create folders inside one document library. everything works fine expect after folders have been created, folders all have very strange name. for example if my document library's name is 000, then the folder name's is "1._000". I tried a lot of other properties, but i have no luck to find out how to set the folder name right. Can some one help me on this?
Cheers
You are right about the webservices are a bit more strict on the characters you can put in and it cannot process the same amount of requests, but you can work around that I guess :)
What you can do though if you really want to use the ProcessBatchData method is, re-use the result you receive back from the method. If it's correct, you will get all the ListItemId's back from each folder. Using the Id's you can create another batch to rename the Title's of the items.
But if I were you, I would switch and use the webservice and workaronud that :)
this is the correct syntax of the XML to create a folder truly titled:
<?xml version="1.0" encoding="utf-8"?>
<ows:Batch OnError="Continue">
<Method ID="Test">
<SetList Scope="Request">82d62a9a-55ba-49c8-a9b8-68ec965a5931</SetList>
<SetVar Name="Cmd">Save</SetVar>
<SetVar Name="ID">New</SetVar>
<SetVar Name="Type">1</SetVar>
<SetVar Name="owsfileref">/sites/1/docs/folder1</SetVar>
</Method>
</ows:Batch>
the critical line is this one:
<SetVar Name="Type">1</SetVar>
"Type" is the accepted alias of the FSObjType field
Regards,
Ahmad
Assuming there is some way to do this... I am using WSS 3.0 and SP Designer 2007. I've changed a list to its XSLT data view in SPD, and am trying to add a formula to display the first 250 characters of the body text, and then IF there are additional characters, add a "(more)" link to the list item.
The problem I'm running into is the conditional aspect... the following successfully adds the "(more)" text and links correctly. But I can't seem to figure out how to only execute it if the body text > 250 characters. Any ideas?
concat(substring(#Body,0,250),'... (more)')
I can use string-length(#Body) to get the length... but how do I put these together?
Thanks,
Mark
Does this help?
<xsl:choose>
<xsl:when test="string-length(#Body) > 250"></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
Some time ago I wrote an article on my blog about creating short descriptions (basically the same case that you're mentioning but then for the Content Query Web Part). It might help you get some answers. The article is available # http://blog.mastykarz.nl/generating-short-description-content-query-web-part/