inserting and deleting valid xml nodes

Discussion in 'XML' started by indo3, Jul 2, 2004.

  1. indo3

    indo3 Guest

    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.
    indo3, Jul 2, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. naija naija
    Replies:
    0
    Views:
    483
    naija naija
    Sep 28, 2004
  2. indo3
    Replies:
    0
    Views:
    437
    indo3
    Jul 3, 2004
  3. gavnosis
    Replies:
    0
    Views:
    493
    gavnosis
    Aug 2, 2003
  4. cesarcesar

    Inserting Nodes between Nodes

    cesarcesar, Jan 21, 2008, in forum: XML
    Replies:
    4
    Views:
    366
    Joseph Kesselman
    Jan 22, 2008
  5. naija naija

    Inserting,Deleting and modyfing TreeNode Xml of Treeview

    naija naija, Sep 28, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    119
    naija naija
    Sep 28, 2004
Loading...

Share This Page