Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

DataNodeBuilder class was modified to add the method 'withModuleNamewithModuleNamePrefix()' which adds a module name attribute to the DataNode object being built.

When the buildFromAttributes() method is called it then calls the added method addModulePrefixToXpath(moduleName). 

 addModulePrefixToXpath(moduleName) contains the following logic

...

collapsetrue

...

sets the DataNode attribute 'moduleNamePrefix'.

When the response is being made from methods such as GetDataNode and QueryNodes it calls DataMapUtils class.



Results of modifying cps core output through DataNodeBuilder and DataMapUtils

XpathResponse
/


Code Block
collapsetrue
{
  "stores:bookstore": {
    "bookstore-name": "Chapters",
    "categories": [
      {
        "code": "02",
        "name": "kids",
        "books": [
          {
            "lang": "en",
            "price": 699,
            "title": "The Golden Compass",
            "authors": [
              "Philip Pullman"
            ],
            "pub_year": 1995
          }
        ]
      },
      {
        "code": "01",
        "name": "SciFi",
        "books": [
          {
            "lang": "en",
            "price": 1099,
            "title": "Far Horizons",
            "authors": [
              "david Brin",
              "Ursula K. Le Guin",
              "Rober Silverberg",
              "Orson Scott Card",
              "Greg Bear",
              "Joe Haldeman",
              "Dan Simmons"
            ],
            "pub_year": 1999
          },
          {
            "lang": "en",
            "price": 895,
            "title": "Feersum Endjinn",
            "authors": [
              "Iain M. Banks"
            ],
            "pub_year": 1994
          }
        ]
      }
    ]
  }
}


/bookstore/categories[@code='02']


Code Block
collapsetrue
{
  "stores:categories": {
    "code": "02",
    "name": "kids",
    "books": [
      {
        "lang": "en",
        "price": 699,
        "title": "The Golden Compass",
        "authors": [
          "Philip Pullman"
        ],
        "pub_year": 1995
      }
    ]
  }
}


...

Example module namestores
Xpath parameterExpected modified XPath set as data node XPath attributenode identifier
/bookstore/stores:bookstore
/bookstore/categories[@code='02']/bookstore/stores:categories[@code='02']

...