f



inserting and deleting valid xml nodes

Hello,
I program an xml editor with xerces for the university of
Braunschweig, the user
dont see any xml tags, it is represented in a JTree.
Now the user shall be able to insert nodes, which
conforms to the schema file (the user need not know what
that is, its transparent to him). I found two approaches for doing
that:

1. When xerces validates the source or the DOM tree (this is a new
xerces feature
and is faster since the tree structure is already there, by
normalizeDocument()),
it builds up for each node a vector holding all possible allowed
schema types, and
then just looks if that node's type is in that vector. I could
store that vector for my own purposes and let the user choose, what
node he wants to insert, according to the vector.
There are some difficulties in that: First, its hard to get that
vector,
there are not-public methods building it up and using it, its very
hard.
Second, DOMNormalizer only accepts the document root as input, and not
a child
node, but I dont want to run the DOMNormalizer after each little
modification on the
whole file, this would take to much time at a large file and a quick
user. Surely with some "hacking" (that means, with modification of
xerces source files) I could do it on child nodes somehow, but this is
even more complicated. Moreover, if I insert a node, I would have to
check
if the following sibling nodes are allowed at there new by-one-shifted
positions. This is needed especially at the deletion of a node in
backwards direction. Otherwise the node's type is not allowed to be
inserted or deleted.

2. I could use PSVI information. With PSVI information, I can see the
schema type definition of every node in the DOM tree. The good thing
is that I dont need to modify
internal xerces files. But what I dont know right now, since I not
programmed
it yet: If I can get an exact vector of all allowed schema node types
possible for one position in the DOM tree like with the first
approach. Moreover i am
cared about the thought that with this approach, I would virtually
program
a complete validator: the schema type of an element is defined by the
elements
name, which can be simply looked up in the schema file. So the
pseudocode

while GetNextElementName do
if !(ElementType isin VectorWithAllowedTypesAtCurrentPosition) then 
 DocumentIsNotValid();
 
 
looks to me like a validator!


So nice of you to read such much text, any suggestions what i should
do are welcome!


PS: it could be that i messed up some things, I am just tackling the
problems
again after months of delay.
0
indo34 (12)
7/2/2004 10:27:23 PM
comp.text.xml 8781 articles. 0 followers. Post Follow

0 Replies
339 Views

Similar Articles

[PageSpeed] 2

Reply:

Similar Artilces:

XML DOM: XML/XHTML inside a text node
In my program, I get input from the user and insert it into an XHTML document. Sometimes, this input will contain XHTML, but since I'm inserting it as a text node, xml.dom.minidom escapes the angle brackets ('<' becomes '&lt;', '>' becomes '&gt;'). I want to be able to override this behavior cleanly. I know I could pipe the input through a SAX parser and create nodes to insert into the tree, but that seems kind of messy. Is there a better way? Thanks. On Thu, 2 Nov 2005 noahlt@gmail.com wrote: > In my program, I get input from the us...

XML to XML
I have a gnucash file that I'm trying to transform into an identical XML file without the invoices. I've been at this for a while now. The gnucash file is in XML and the element I'm looking into is: <gnc:transaction> I want to ignore those that contain <slot:key>gncInvoice</slot:key> which is a child of slot which is a child of slots which is a child of transactions. Any help you're willing to provide would be greatly appreciated. Thanks. Classic application for XSLT. Start with the identity transformation, then add a template which matches the ones you want to treat specially and yields no output. From your description that would be match="gnc:transaction[transactions/slots/slot/slot:key='gncInvoice']" with the namespaces declared appropriately in the stylesheet. (That looks like a somewhat unlikely markup design to me, but since I haven't played with gnucash at all I'm taking your word for it.) -- () ASCII Ribbon Campaign | Joe Kesselman /\ Stamp out HTML e-mail! | System architexture and kinetic poetry Actually, from the Relax-NG schema for gnucash, it looks like it should be more like "gnc:transaction[trn:slots/slot/slot:key='gncInvoice']" with gnc:, trn:, and slot: all bound to the appropriate namespace URIs. The fact that some of their elements -- eg <slot> -- aren't in any namespace is probably left over from a pre-namespaces initial design, as is their now-brok...

XML or not XML?
I am developing a simple MySQL database editor, and am looking into creating an PHP/AJAX app as the GUI. A lot of this in new ground, and much more is dusting off things I haven't used in a while. My question though involves whether or nor to employ XML. I did some XML a few years back, but don't typically bother anymore. As I see it XML is great when I need to have an app with a standard data presentation that other developers can easily interface. I.E. like a bank statement that may feed a variety of applications developed by a variety of clients. However, if I am develo...

To XML or not to XML?
Ok, it has been a while since I've needed to make an involved web page. Coming back on the scene now is a bit confusing, what with all the cool stuff to use like XML, PHP, MySQL, etc... So here is my question. I'm in search of a good dynamic way to generate web pages which separates content from presentation. I am seeking to create a web site that, to put it succinctly, has a list of users and sets of information corresponding to each user. I am familiar with how to do this using PHP, MySQL, and regular old HTML. I maintain the user database in MySQL and dynamically present it and the information with PHP. This is very easy to do in terms of coding for it. But I'm wondering? Is it time for me to switch to the XML with XSL method instead? Everyone seems to be talking of XML as the end all be all. I've looked into it, and on the surface, I just can't tell if it's worth it. I don't really see the benefit. XML is just a "create your own HTML tags" and then figure out wtf to do with them orgy. Great, so I can write <dog>Spot</dog>. Whoop de do, that's useless to me unless I write a parser for it to display it in a user friendly way. And I shouldn't have to write a parser, there should be standardized ones for certain purposes. But wait, isn't that what HTML already is? A bunch of <dog>Spot</dog> (figuratively speaking) with the parsers having been written and mostly standardized between companies ages ago...

XML Validation From XML Schema
I am trying to validate a XML file from java according to a XML Schema and get a list of all elements that fail validation. I am utilizing a class that implements the ErrorHandler interface and can generate the list if all errors. The problem is that I need to send back the XPath of the offending elements. The data in the message field of the ErrorHandler is not the complete XPath. Does anyone have a solution of this problem? MJ ...

embedding xml in xml as non-xml :)
Hi all, I have an application that logs in xml. Assume <xmlLog></xmlLog>. In this element the app logs anything it gets from foreign hosts. Now if the host sends xml data, the structure of the document changes. ie. <xmlLog><somTag></somTag></xmlLog>. This will cause problems with my log reader, because it assumes that <xmlLog/> contains non-xml data. My question is, is there a way to treat the data in the <xmlLog/> element as non xml data. Something I can do that would treat anything this element contains as a literal? Any help or suggestions would be greatly appreciated. Regards, Mark Mark Van Orman <mark@icsaccess.com> wrote: > Hi all, > > I have an application that logs in xml. > > Assume <xmlLog></xmlLog>. In this element the app logs > anything it gets from foreign hosts. Now if the host sends xml > data, the structure of the document changes. ie. > <xmlLog><somTag></somTag></xmlLog>. This will cause problems > with my log reader, because it assumes that <xmlLog/> contains > non-xml data. > > My question is, is there a way to treat the data in the > <xmlLog/> element as non xml data. Something I can do that > would treat anything this element contains as a literal? > > Any help or suggestions would be greatly ap...

XML schema validation of one xml block based on values from another xml block
Hi! Is possible to do xml validation of one xml block based on values from another xml block? For example, I have an input xml file containing account types. <Root> <AccountTypes> <AccountType></AccountType> �������������.. </AccountTypes> <Accounts> <Account> <AccountType></AccountType> </Account> </Accounts> </Root> Is there a way I can put restriction in schema that <Account> must have only such <AccountType> that are listed in <AccountTypes> The file size is 20-25 MB. (It would not be a good idea to load it into DOM) It is preferably to catch it before processing will start Thank you, Andy ...

Reality check: Is it sensible to link XML nodes to other XML nodes in the same file?
I've got a whole list of descriptions of stages in a production process, which are organised as a sequence of steps, with some branching (i.e. a sort of flow chart)... and thought I'd try and get with the times and model the data using XML! I'm hoping I'll eventually be able to display each 'step' (node) on it's own Web page, and show what link comes next. Is this a sensible thing to attempt to do? If so, how do I link to other nodes in the XML file? Should the <link> be to another node's <id>? And will each node need a 'friendly' <name>, too? (As you've probably gathered, this is all quite new to me...) Any advice or examples would be gratefully received. Gavnosis ...

Problem to insert an XML-element by XSLT-converting from one XML-file into another XML-file
Hello, i convert one XML-document by using XSLT into another XML-document. First change all attributes to elements is no problem. Then i try to insert a new element into the new document by XSLT, but it doesn't work correctly :-( Example: The XML-source-document: <?xml version="1.0" encoding="UTF-8"?> <data creationTime="2006-05-31" creationNumber="1"> <set number="0001" info="test"/> <set number="0002" info="test"/> </data> The following XML-destination-document has to become (watch the new element "sets"): <?xml version="1.0" encoding="UTF-8"?> <data> <creationTime>2006-05-31</creationTime> <creationNumber>1</creationNumber> <sets> <set> <number>0001</number> <info>test</info> </set> <set> <number>0002</number> <info>test</info> </set> </sets> </data> Here is my XSLT-stylesheet-attempt: <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" /> <xsl:template match="@*"> <xsl:element name="{name()}"> <xsl:value-of select="."/> </xsl:element> <xsl:if test="n...

XML Schema to validate against XML encryption
Hello, I'm trying to write a XML Schema to validate against a XML file which holds an element which contains either a plaint text password or a XML encryption element. A plain text example is: <Password>mySecret</Password> or a XML encrypted element: <Password> <EncryptedData xmlns="http://www.w3.org/2001/04/xmlenc#" Type="http://www.w3.org/2001/04/xmlenc#Content"> <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> <CipherData> <CipherValue>Jha8fYGDje49Tkz0=</CipherValue> </CipherData> </EncryptedData> </Password> I tried to validate against it with following XML Schema: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" elementFormDefault="qualified"> <xsd:import namespace="http://www.w3.org/2001/04/xmlenc#" schemaLocation="http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/xenc-schema.xsd"/> <xsd:element name="Secret"> <xsd:complexType> <xsd:sequence> <xsd:element name="EncryptedData" type="xenc:EncryptedDataType" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:element> But it fails wi...

Validate XML against DTD and/or XML Schema?
Hi folks, I have a need to validate XML files against both DTDs and XML Schema from the command line. In an ideal world, I'd be able to do something like: $ python validate.py foo.xml which would then parse and validate foo.xml using the schema or DTD referenced within it. What I'm looking for is the contents of validate.py. A Python solution isn't essential, but I like Python and I'm doing some other light XML stuff in Python, so I'd prefer it. I did some Googling, but I'm a little overwhelmed by the quantity and variety of stuff I found, and I found a lot of s...

Validate xml via xml schema
hi, I have a LabVIEW VI where i read some elements from a .xml file. First i use the function Read_Characters_From_File and the output string is wired on property/method nodes of a MSXML Refnum. But on the point where i read from xml, the VI should check the associated xml schema (.xsd/.dtd). Is there any possibilty to get a pass oder fail if the xml document do/do not correspond to the DTD schema which belong to the xml file?LabVIEW version is 7.1Thanks for answer,shavo Hi shavo, i think you can use the activex webbrowser component to check the xml file. Hope it helps.Mike thanks for reply,...

file command: "XML document text" vs "XML document text"
I've just used the file command on four files of RDF-XML with the following output: augtfidf.rdf: XML document text kyoto.rdf: XML document text stuff.rdf: XML document text tfidf.rdf: XML document text What does it mean that one of them has an extra space between "XML" and "document"? -- The kid's a hot prospect. He's got a good head for merchandising, an agent who can take you downtown and one of the best urine samples I've seen in a long time. [Dead Kennedys t-shirt] On 16.10.2012 16:06, Adam Funk wrote: > I've just used the file command on four files of RDF-XML with the > following output: > > augtfidf.rdf: XML document text > kyoto.rdf: XML document text > stuff.rdf: XML document text > tfidf.rdf: XML document text > > What does it mean that one of them has an extra space between "XML" > and "document"? Hard to tell without further information. What does file *.rdf | od -c show you? Janis Janis Papanagnou wrote: > On 16.10.2012 16:06, Adam Funk wrote: >> I've just used the file command on four files of RDF-XML with the >> following output: >> >> augtfidf.rdf: XML document text >> kyoto.rdf: XML document text >> stuff.rdf: XML document text >> tfidf.rdf: XML document text >> >> What does it mean that one ...

XML validating using XML Schema in C
Hay friends. I am making XML parser using linux C. I would like to know some of the functions about validating my XML file with XML Schema in C. If any one has idea about parsing and validating XML doc with XML Schema using libxml.a or libxml2.a library in linux. Please do reply me back asap. thanks in advance. Jigar ...

Non-XML tagged value text to XML
I would like to use XSLT to translate some tagged value text to XML elements like this: Input Doc: <data>x=1.234 y=ABC z="Hello World"</data> Output Doc: <x>1.234</value> <y>ABC</y> <z>&quot;Hello World&quot;</z> Is XSLT up to the task? What would it look like? Most of the XSLT string processing code I've seen looks very verbose - can't be too efficient. mikea_59 wrote: > I would like to use XSLT to translate some tagged value text to XML > elements like this: > > Input Doc: > > <data>x=1.234 y=ABC z="Hello World"</data> > > Output Doc: > > <x>1.234</value> > <y>ABC</y> > <z>&quot;Hello World&quot;</z> > > Is XSLT up to the task? What would it look like? Most of the XSLT > string processing code I've seen looks very verbose - can't be too > efficient. Using XSLT 2.0 you can do that with regular expression matching as follows: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" encoding="UTF-8" indent="yes" /> <xsl:template match="/"> <results> <xsl:apply-templates /> </results> </xsl:template> <xsl:template match="data"...

Checking XML DTD syntax and validating XML
Does anyone know of a decent tool, preferably free, that will check and validate DTD syntax, to make sure that my DTD is correct? The only tool that I have found thus far is the IBM visual DTD tool, which I do like, but is limited. Basically, your DTD is "good" when it parses... and I am not sure this is the best way to do it. As for validation of XML, I have found a great tool, xmlvalid, here: < http://www.elcel.com/products/xmlvalid.html > Cliff Hi Cliff xmlspy from altova is contains a DTD validator. Xmlspy is an excellent tool. Unfortunately it is not free, however you may download a 30day trial from their website. /Sebastian www.tomac.se "Clifford W. Racz" <racz.junk@verizon.net> wrote in message news:10c9p30851anab1@corp.supernews.com... > Does anyone know of a decent tool, preferably free, that will check and validate DTD syntax, to make sure that my DTD is correct? > > The only tool that I have found thus far is the IBM visual DTD tool, which I do like, but is limited. Basically, your DTD is "good" when it parses... and I am not sure this is the best way to do it. > > > > As for validation of XML, I have found a great tool, xmlvalid, here: > < http://www.elcel.com/products/xmlvalid.html > > > > Cliff Sebastian Tomac wrote: > xmlspy from altova is contains a DTD validator. Xmlspy is an excellent tool. > Unfortunately it is not free, however you may download a 30day tri...

q) XML Schema and valid XML documents
Wikipedia provides the following definition for valid XML document (http://en.wikipedia.org/wiki/XML): it contains a reference to a Document Type Definition (DTD), and that its elements and attributes are declared in that DTD and follow the grammatical rules for them that the DTD specifies. There is no reference to XML Schema in the above defintion. I am presuming that this is a dated definition for valid XML document and that an XML document that has an XML Schema associated with it is also a valid XML document. Kindly confirm. Thanks, Ramesh In article &l...

Validating parsed XML document against XML-schema
*PROBLEM: how to validate parsed XML document against (parsed) XML-schema. *IN: XML document as org.w3c.dom.Document, XML-schema as stream *OUT: information if document is valid against schema. If document is not valid DETAILED information about ALL errors (especially: node that caused problem). *Additional information: - validation is performed quite often, - XML-document object is changed quite often, - XML-Schema is fixed. - XML-document doesn't contain information about related XML-schema (attr xsi:noNamespaceSchemaLocation) - XML-Sche...

Validating XML against a DTD that is not supplied in the XML Schema
Hi, I'm talking the problem of trying to validate whether a rss xml feed is well formed - i.e corresponds to the DTD and xml schema definitions. Given that rss comes in a number of forms: * Sometimes a DTD is referenced * Sometimes a schema is referenced, with namespaces * Most of the time, no DTD or schemas or namespaces are defined. My application requires to know whether an rss feed supplied is valid as there is processing on the data that occurs later. My orignal tack was to parse the data into objects ( via RSSDigester ) and then apply business logic. However, given that functio...

Generate xml node tree from xmi (xml) help
Hi, I am using argouml ( really neat UML modeling tool) to create a model. I export the model to xmi format ( it's xml). My UML-diagram looks like this: Brand A | -------------------- | | | Brand B Brand C Brand D And Brand B, Brand C and Brand D can also have children and so on ......... I need to generate an xml file that can describe these relationships like: <MyModel> <Brand A> <Brand B> </Brand B> <Brand C> </Brand C> <Brand D> </Brand D> </Brand A> </MyModel> I am thinking of checking the children for root (Brand A) and generate TAGs for each node. Then I make the first node to the left (Brand B) the parent get all children for that one. Any one with hints on how I can do this in xslt. I need some sort of traversing to get the tree right? Regards, //Mikael -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ Mikael P wrote: > Hi, > > I am using argouml ( really neat UML modeling tool) to create a model. I > export the model to > xmi format ( it's xml). Try posting that XML . . Soren -- Fjern de 4 bogstaver i min mailadresse som er indsat for at hindre s... Remove the 4 letter word meaning "junk mail" in my mail address. ...

XML to XML conversion
Hello, I vageuly remember a standard that allowed for an XML document using one tag vocabulary to be translated to a diffirent XML document using a diffirent tag vocabulary using the information provided in a kind of dictionary XML pointed to in an URL present in the original XML file. I am very interested in trying it out for various applications, but I can't find anything on the internet about it, since I don't remember it's name, only the general appearance. Can anyone help me with this? What I remember, approximately: The idea is that you have one XML file, in which the namespace is defined in the standard way, using an URI. The URI, however, is pointing to an online XML file. For example: <x xmlns:abc="http://www.server.org/dictionary.xml"> <abc:one>orange</abc:one> </x> This dictionary.xml then contains, for example: <root> <one> <format1>1</format1> <format2>uno</format2> <format3>ena</format3> <format4>ein</format4> </one> </root> So a program wishing to convert the original XML to, say format2, would end up with the following XML: <x> <uno>orange</uno> </x> What I remember is that this dictionary trick was mainly used to allow diffirent software to be able to interpret the same XML file, without all of the software needing to be programmed for the same tag vocabulary. The program w...

XML to XML Transformation
I was thrust into XML about 2 weeks ago and don't know much yet. From another department in the corp I am receiving an XML file which concatenates nodes all on one line i.e. <car><make>ford</make><color>red</color><year>2001</year></car><car><make><mb> etc. etc. etc. Some lines are over 300 characters long. I need to translate this spagetti XML into something which is humanly readable. I probably need to use XSL however I'm not sure what I need to do. Any help will be much appreciated. "Will" <william.cook@kla-tencor.com> wrote in message news:8506d1f6.0310311244.49a0856c@posting.google.com... > I was thrust into XML about 2 weeks ago and don't know much yet. From > another department in the corp I am receiving an XML file which > concatenates nodes all on one line i.e. > <car><make>ford</make><color>red</color><year>2001</year></car><car><make><m b> > etc. etc. etc. Some lines are over 300 characters long. I need to > translate this spagetti XML into something which is humanly readable. View the xml file using IE or Mozilla -- they provide an appealing, aesthetic looking layout with collapse/expanding of contents of elements. > I probably need to use XSL however I'm not sure what I need to do. If you decide to use XSLT (if, because the first approach above is really what one needs...

Validating xml file against xml schema using javascript
Hi All, I am trying to take an xml file as input from user and update the sql database with this new data from the xml file. Before going to the step of updating the data in the database, i want to validate this xml file with the xml schema file that i have, to make sure that the user has indeed provided a correctly formed xml, and that the schema of the xml is correct. Now i have searched for some examples as i am new to working with xml files, all i get is samples for .net (xmlvalidatingreader). Can you please give me samples that can be used in asp (not asp.net please) using javascript to validate an xml file against a given xml schema file. Appreciate your help a lot ...

validating XML node data
Hi folks Is there a piece of software or a wbsite that validates the content inside an XML node? I download an XML feed and when I export it from MSAccess to an XML file and transform it with an XSL file, no results are returned. I know that the format of the XML file is correct. It must be some sort of non standard character inside one of the nodes that is causing this. The XML file I am using is huge and constantly updating and would take me ages to go through it and locate manually. There must be some way to check for this automatically, please say there is. Thanks Tom tom wrote: > Is there a piece of software or a wbsite that validates the content inside > an XML node? Any XML parser will flag not well-formed errors and a validating parser can validate against a DTD or a schema. -- Martin Honnen http://JavaScript.FAQTs.com/ The problem seems to be when there is a � sign in the data inside a node. I went through the whole file until I found this, removed it and the problem was solved, I had the same problem a while a go as well, that time there was an accent on one of the letters. On both ocassions it took me ages to locate. Surely there some way to check it appart from going through it one by one. "tom" <thoams_patton@ntlworld.com> wrote in message news:MJQzf.2868$mf2.84@newsfe6-win.ntli.net... > Hi folks > > Is there a piece of software or a wbsite that validates the content inside > an XML node? > &g...

Web resources about - inserting and deleting valid xml nodes - comp.text.xml

Inserting Kate
jurvetson posted a photo: the speaking GPS avatar that we came to love.. more prep photos below... You can hear her voice in the video compilation ...

Inserting the Galaxy Note 5’s S Pen backwards can permanently damage the device
One of the features Samsung highlighted when it unveiled the Galaxy Note 5 was the device's new S Pen slot design. The Note 5 features a spring-loaded ...

How the Shift from Swiping to Inserting Cards Will Accelerate Mobile Payments
... this shift is to protect consumers and merchants from fraud. What the industry refers to as "dipping" and consumers and cashiers call "inserting" ...


Inserting Slavery Into The Climate Debate
Chris Hayes compares the fight against fossil fuels to the abolitionist movement. He states plainly that “there is absolutely no conceivable ...

Samsung smart TVs inserting ads into third-party apps
... playback have pissed off a number of consumers. People with smart TVs from Samsung have been complaining that the electronics maker is inserting ...

Samsung: Inserting the S Pen backwards will not break new Galaxy Note 5 units
... according to the company. "Samsung can confirm that the Note 5 internal S Pen mechanism has been changed to avoid the issue caused by inserting ...

Gawker tells Steven Crowder to "stop whining, take your licks, and accept that getting hit in the face ...
"... in the middle of an argument between billionaire-funded know-nothing ideologues and people whose livelihoods and stability are being threatened ...

Gmail's New Interface for Inserting Photos
Gmail has a new interface for adding images to a message. When you click the "insert images" icon, Gmail now shows all the photos highlighted ...

Now Samsung SmartTVs are interrupting users' videos by inserting random ads
... room. Now Samsung is dealing with a new headache: Gigaom reports that Samsung SmartTVs are interrupting users' own video content by inserting ...

Resources last updated: 3/14/2016 12:41:53 AM