SchemaComplexContent.cpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #include "jptree.hpp"
  14. #include "XMLTags.h"
  15. #include "SchemaComplexContent.hpp"
  16. #include "SchemaExtension.hpp"
  17. #include "ConfigSchemaHelper.hpp"
  18. using namespace CONFIGURATOR;
  19. #define StringBuffer ::StringBuffer
  20. #define IPropertyTree ::IPropertyTree
  21. CComplexContent* CComplexContent::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
  22. {
  23. assert(pSchemaRoot);
  24. if (pSchemaRoot == nullptr)
  25. return nullptr;
  26. StringBuffer strXPathExt(xpath);
  27. strXPathExt.append("/").append(XSD_TAG_EXTENSION);
  28. if (pSchemaRoot->queryPropTree(strXPathExt.str()) == nullptr || IS_EXCLUDED(XSD_EXTENSION) == false)
  29. return nullptr;
  30. CExtension* pExtension = CExtension::load(nullptr, pSchemaRoot, strXPathExt.str());
  31. CComplexContent *pComplexContent = new CComplexContent(pParentNode, pExtension);
  32. pComplexContent->setXSDXPath(xpath);
  33. assert(pExtension != nullptr);
  34. assert(pComplexContent != nullptr);
  35. if (pExtension != nullptr && pComplexContent != nullptr)
  36. {
  37. SETPARENTNODE(pExtension, pComplexContent);
  38. pExtension->initExtension();
  39. }
  40. return pComplexContent;
  41. }
  42. void CComplexContent::dump(::std::ostream& cout, unsigned int offset) const
  43. {
  44. offset+= STANDARD_OFFSET_1;
  45. quickOutHeader(cout, XSD_COMPLEX_CONTENT_STR, offset);
  46. QUICK_OUT(cout, XSDXPath, offset);
  47. if (m_pExtension != nullptr)
  48. m_pExtension->dump(cout, offset);
  49. quickOutFooter(cout, XSD_COMPLEX_CONTENT_STR, offset);
  50. }
  51. void CComplexContent::getDocumentation(StringBuffer &strDoc) const
  52. {
  53. return;
  54. }
  55. const char* CComplexContent::getXML(const char* /*pComponent*/)
  56. {
  57. if (m_strXML.length() == 0 && m_pExtension != nullptr)
  58. m_strXML.append(m_pExtension->getXML(nullptr));
  59. return m_strXML.str();
  60. }